import { createRouter, createWebHistory } from 'vue-router'

declare const window: Window & {
  __POWERED_BY_QIANKUN__: boolean;
  __INJECTED_PUBLIC_PATH_BY_QIANKUN__: string;
};

// 判断是否在qiankun环境中
const isInQiankun = window.__POWERED_BY_QIANKUN__;

// 修改路由基础路径 - 在qiankun中运行时，路径需要加上'/staff'前缀
const BASE_NAME = isInQiankun ? "/administration" : "/";
console.log("Router base path:", BASE_NAME, "isInQiankun:", isInQiankun);

const router = createRouter({
  history: createWebHistory(BASE_NAME),
  routes: [
    
  ]
})

// // 添加路由守卫，用于调试 
// router.beforeEach((to, from, next) => {
// <<<<<<< HEAD
//   console.log('Current route:', to.path);555
//   console.log('Base name:', BASE_NAME);
// =======
//   console.log('Staff app - navigating to:', to.fullPath);
//   console.log('Staff app - from:', from.fullPath);
//   console.log('Staff app - base path:', BASE_NAME);
//   console.log('Staff app - is in qiankun:', isInQiankun);
// >>>>>>> 114df74f9d05ef4f408068522d2a02357df6b796
//   next();
// });

export default router;